package beans {
	import mx.collections.ArrayCollection;
	
	public class ApproveInfoBean {

		//------------------------------------------------------------
		//
		// variables
		//
		//------------------------------------------------------------
	
		//------------------------------
		// roomID
		//------------------------------

		private var _roomID:uint;

		public function get roomID():uint {
			return _roomID;
		}

		public function set roomID(roomID:uint):void {
			_roomID = roomID;
		}
	
		//------------------------------
		// companyID
		//------------------------------

		private var _companyID:uint;

		public function get companyID():uint {
			return _companyID;
		}

		public function set companyID(companyID:uint):void {
			_companyID = companyID;
		}
	
		//------------------------------
		// companyList
		//------------------------------

		private var _companyList:ArrayCollection;

		public function get companyList():ArrayCollection {
			return _companyList;
		}

		public function set companyList(companyList:ArrayCollection):void {
			_companyList = companyList;
		}
	
		//------------------------------------------------------------
		//
		// constructor
		//
		//------------------------------------------------------------
		
		public function ApproveInfoBean(value:XML) {
			if (!value) {
				companyList = new ArrayCollection();
				return;
			}
			
			roomID = uint(value.roomID);
			companyID = uint(value.companyID);
			
			companyList = new ArrayCollection();
			for each (var companyNode:XML in value.companyList.company) {
				var cb:CompanyBean = new CompanyBean(companyNode);
				companyList.addItem(cb);
			}
		}
		
		/**
		 * represent this object as a xml object
		 * @return the string format of the xml object
		 */
		public function toXMLString():String {
			var rootNode:XML = <results/>;
			
			var dataNode:XML = <data/>;
			rootNode.appendChild(dataNode);
			
			var roomIDNode:XML = <roomID>{roomID}</roomID>;
			dataNode.appendChild(roomIDNode);
			
			var companyIDNode:XML = <companyID>{companyID}</companyID>;
			dataNode.appendChild(companyIDNode);
			
			return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + rootNode.toXMLString();
		}

	}
}